Skip to content

Conversation

@WnRock
Copy link
Contributor

@WnRock WnRock commented Dec 2, 2024

Raise InvalidSourceList error if new source file is not found. dmypy now correctly reflects the absence of non-existent files, which was previously not reported.

Fixes #18111


Testing

I manually tested the changes and confirmed that dmypy now correctly reports errors when attempting to check non-existent files:

$ dmypy run -- a.py
Success: no issues found in 1 source file
$ dmypy run -- nonexistent.py
mypy: can't read file 'nonexistent.py': No such file or directory

I haven't added tests yet, as I'm still familiarizing myself with the testing framework used in the project. If this change is deemed appropriate, I will add the necessary test cases soon to ensure it is thoroughly validated.

I’m eager to contribute further and ensure this fix is robust. Thank you for your support and feedback!

Raise `InvalidSourceList` error if new source file is not found

Fixes python#18111
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2024

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@KotlinIsland
Copy link
Contributor

a test would be good here

@WnRock
Copy link
Contributor Author

WnRock commented Dec 4, 2024

Based on the existing test cases, particularly (in test-data/unit/fine-grained.test):

[case testNonExistentFileOnCommandLine4]
# cmd: mypy a.py nonexistent.py
[file a.py]
[file nonexistent.py]
[delete nonexistent.py.2]
[out]
==

It appears that the behavior of ignoring a nonexistent file after caching the previous result is intentional? (Please let me know if my understanding of this test case is correct.) This could be why some tests are currently failing.

Additionally, if the change proposed in this PR is appropriate, we may need to modify many existing test data to align with the new behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(🐞) dmypy can check files that dont exist

2 participants